package com.ricky.room.db

import androidx.room.*

/**
 * @ClassName: UserDao
 * @Description:
 * @Author: Haiyang
 * @Date: 2021/7/21 22:27
 */
@Dao
interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertUser(vararg users: User)

    @Delete
    fun deleteUser(user: User)

    @Query("DELETE FROM user")
    fun deleteAll()

    @Update
    fun updateUser(user: User)

    @Query("SELECT * FROM user")
    fun queryAllUser(): List<User>

    @Query("SELECT * FROM USER WHERE name=:name")
    fun queryByName(name: String): User?
}